#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=tt2go_icon.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Portableapps.com extractor for tt2go
#AutoIt3Wrapper_Res_Description=tt2go pae
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Project:        Tech Tools To Go
 Author:         Joe Vasquez

#ce ----------------------------------------------------------------------------
; Includes
#include <Array.au3>

; AutoIt Options
Opt("WinTitleMatchMode", 2)

; Program Options
$timedelay = 250

; Check for command line arguments
If $CmdLine[0] = 2 Then
	$portableapps_file = $CmdLine[1]
	$dest_dir = $CmdLine[2]
	
	If Not FileExists($portableapps_file) Then
		MsgBox(0, "Error", "Could not locate portableapp file.")
		Exit
	EndIf
	
	If Not FileExists($dest_dir) Then DirCreate($dest_dir)
	
	Run($portableapps_file)
	WinWait("PortableApps.com Installer", "Cancel")
	WinActivate("PortableApps.com Installer", "Cancel")
	Sleep($timedelay)
	Send("{ENTER}")
	Sleep($timedelay)
	Send($dest_dir)
	Send("{ENTER}")
	WinWait("PortableApps.com Installer", "Finish")
	WinActivate("PortableApps.com Installer", "Finish")
	Sleep($timedelay)
	Send("{ENTER}")
Else
	; Send the user a nice error message
	MsgBox(0, "Error", "This program uses 2 arguments (portableapps file, destination folder).")
	Exit
EndIf